using HMCollada.Core;
using System.Xml;
namespace HMCollada.Core {
    internal struct HMColladaGeometry {
        internal string id;
        internal string name;
        internal HMColladaAsset asset;
        internal HMColladaGeometryType mesh; // also convex_mesh, but not spline
    }
}

namespace HMCollada {
    internal partial class HMColladaLoader {
        private static HMColladaGeometry LoadGeometry() {
            HMColladaGeometry newGeometry = new HMColladaGeometry();
            newGeometry.id = colladaReader.GetAttribute("id");
            newGeometry.name = colladaReader.GetAttribute("name");

            if (!colladaReader.IsEmptyElement) colladaReader.Read();
            do {
                if (colladaReader.NodeType != XmlNodeType.EndElement) {
                    switch (colladaReader.Name) {
                        case "asset": newGeometry.asset = LoadAsset(); break;
                        case "convex_mesh": newGeometry.mesh = LoadConvexMesh(); break;
                        case "mesh": newGeometry.mesh = LoadMesh(); break;
                        case "param": colladaReader.Read(); break;
                        case "input": colladaReader.Read(); break;
                    }
                }

                if (!colladaReader.IsEmptyElement) colladaReader.Read();
            } while (colladaReader.Name != "geometry");

            if (colladaReader.IsEmptyElement) colladaReader.Read();
            return newGeometry;
        }
    }
}